<template>
  <view class="" style="padding-bottom: 400px;">
    <!-- 酒店图片 -->
    <image :src="IMAGE_BASE + hotelInfo.image" mode="widthFix" class="hotel-image"></image>

    <!-- 酒店信息 -->
    <view class="hotel-content">
      <view class="hotel-header">
        <view class="hotel-name">{{ hotelInfo.hotelName }}</view>
        <!-- <view class="hotel-price">
          <text class="price">¥{{ hotelInfo.price }}</text>
          <text class="label">起</text>
        </view> -->
      </view>

      <view class="info-item">
        <view class="item-label">
          <uni-icons type="location" size="16" color="#666"></uni-icons>
          <text>酒店地址</text>
        </view>
        <view class="item-content">{{ hotelInfo.address }}</view>
      </view>

      <view class="info-item">
        <view class="item-label">
          <uni-icons type="phone" size="16" color="#666"></uni-icons>
          <text>联系电话</text>
        </view>
        <view class="item-content">{{ hotelInfo.phone }}</view>
      </view>

      <view class="hotel-desc">
        <view class="section-title">酒店介绍</view>
        <view class="desc-content">{{ hotelInfo.description }}</view>
      </view>
    </view>

    <!-- 底部操作栏 -->
    <view class="bottom-bar">
      <button class="contact-btn" @click="handleContact">联系酒店</button>
    </view>
  </view>
</template>

<script>
import { getHotelDetail } from '@/api/hotel.js'
import config from '../../api/config.js'

export default {
  data () {
    return {
      hotelId: null,
      hotelInfo: {},
      IMAGE_BASE: config.image_base
    }
  },
  onLoad (options) {
    this.hotelId = options.id
    this.getHotelInfo()
  },
  methods: {
    getHotelInfo () {
      getHotelDetail(this.hotelId).then(res => {
        if (res.code === 200) {
          this.hotelInfo = res.data
        }
      })
    },
    handleContact () {
      if (this.hotelInfo.phone) {
        uni.makePhoneCall({
          phoneNumber: this.hotelInfo.phone
        })
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  padding-bottom: 120rpx;
}

.hotel-image {
  width: 100%;
}

.hotel-content {
  padding: 30rpx;
  background: #fff;

  .hotel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30rpx;

    .hotel-name {
      font-size: 36rpx;
      font-weight: bold;
      color: #333;
    }

    .hotel-price {
      .price {
        font-size: 40rpx;
        color: #f56c6c;
        font-weight: bold;
      }

      .label {
        font-size: 24rpx;
        color: #999;
        margin-left: 4rpx;
      }
    }
  }

  .info-item {
    margin-bottom: 20rpx;

    .item-label {
      display: flex;
      align-items: center;
      margin-bottom: 10rpx;

      text {
        margin-left: 10rpx;
        font-size: 28rpx;
        color: #666;
      }
    }

    .item-content {
      font-size: 28rpx;
      color: #333;
      padding-left: 34rpx;
    }
  }

  .hotel-desc {
    margin-top: 30rpx;

    .section-title {
      font-size: 32rpx;
      font-weight: bold;
      color: #333;
      margin-bottom: 20rpx;
    }

    .desc-content {
      font-size: 28rpx;
      color: #666;
      line-height: 1.8;
    }
  }
}

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100rpx;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 30rpx;
  box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);

  .contact-btn {
    background: #f56c6c;
    color: #fff;
    width: 90%;
    height: 80rpx;
    line-height: 80rpx;
    border-radius: 40rpx;
    font-size: 28rpx;
    margin: 0;

    &:after {
      border: none;
    }
  }
}
</style>